﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Navigation;
using Microsoft.Phone.Controls;
using Microsoft.Phone.Shell;
using CRMClient.Models;

namespace CRMClient.Views.AccountViews
{
    public partial class AddAccount : PhoneApplicationPage
    {
        public AddAccount()
        {
            InitializeComponent();
        }

        private void appBarCancelButton_Click(object sender, EventArgs e)
        {
            if (NavigationService.CanGoBack)
            {
                NavigationService.GoBack();
            }
        }

        private void appBarOkButton_Click(object sender, EventArgs e)
        {
            if (name.Text.Equals(""))
                MessageBox.Show("Account name empty");
            else
            {
                App.AccountViewModel.add(name.Text, tel.Text, email.Text,city.Text);
                if (NavigationService.CanGoBack)
                {
                    NavigationService.GoBack();
                }
            }
        }
    }
}